﻿using System.Collections.Generic;
using GameFramework.common;
using UnityEngine;

namespace GameFramework.skill
{
    [CreateAssetMenu(fileName = "EffectConfigManager", menuName = "configs/EffectConfigManager")]
    public class EffectConfigManager:ScriptableObjectSingleton<EffectConfigManager>
    {
        
        private  Dictionary<int, EffectConfig> effectConfigs = new Dictionary<int, EffectConfig>();

        public  List<EffectConfig> configs = new List<EffectConfig>();
        
        public EffectConfig getConfig(int id)
        {
            if (effectConfigs.Count > 0)
            {
                return effectConfigs[id];
            }

            return null;
        }

        protected override void  init()
        {
            //TODO 代码生成，加入容器
            // configs.Add();
            if (effectConfigs.Count == 0 && configs.Count > 0)
            {
                foreach (EffectConfig config in configs)
                {
                    effectConfigs.Add(config.id,config);
                }
            }
        }
    }
}